********************************************************************************
** 	TITLE: e1_arrests_by_living_address.do
**
**	PROJECT: IGNITE
** 
**  PURPOSE: Appendix Figure I: Residential Address of Individuals Booked into Genesee County Jail
**
**	Note: Do-file constructs the data that is then used in R-script 
******arrest_maps_GC.R*********
**	to produce figure
********************************************************************************

set sortseed 13

	use "$output_data/estimate.dta", replace
	est clear
	
cap gen tract_code = countyfp + tract
cap gen gc = countyfp == "049"
cap gen fl = inlist(tract_code, "049000100", "049000200", "049000300", "049000400", "049000500")| ///
	inlist(tract_code, "049000600", "049000700", "049000800", "049000900", "049001000")| ///
	inlist(tract_code, "049001100", "049001200", "049001300", "049001400", "049001500")| ///
	inlist(tract_code, "049001600", "049001700", "049001800", "049001900", "049002000")| ///
	inlist(tract_code, "049980000", "049980100", "049000800", "049000900", "049001000")| ///
	inlist(tract_code, "049002200", "049002300", "049002400", "049002600", "049002700")| ///
	inlist(tract_code, "049002800", "049002900", "049003000", "049003100", "049003200")| ///
	inlist(tract_code, "049003300", "049003400", "049003500", "049003600", "049003700")| ///
	inlist(tract_code, "049003800", "049004000", "049013500", "049013600")

drop if strpos(arrestingagency," CO ")&!strpos(arrestingagency,"GENESEE")

preserve

collapse (count) number = booking_date (max) gc fl  if D_ignite==0&!mi(tract_code), by(tract_code)
format number %9.0g

export excel "$output_data/arrests_pre.xlsx", replace
restore


preserve

collapse (count) number = booking_date (max) gc fl  if D_ignite==1&!mi(tract_code), by(tract_code)
format number %9.0g

export excel "$output_data/arrests_post.xlsx", replace
restore
